home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Online / Epic4 / share / epic / help / 6_functions / regex < prev    next >
Text File  |  2001-03-21  |  2KB  |  48 lines

  1. Synopsis:
  2.    $regcomp(<regex pattern>)
  3.    $regexec(<compiled pattern> <string>)
  4.    $regerror(<compiled pattern>)
  5.    $regfree(<compiled pattern>)
  6.  
  7. Technical:
  8.    These functions are an interface to "regular expression" pattern matching:
  9.    $regcomp() is used to "compile" a regular expression.  The return value
  10.         is suitable for /assigning to an ircII variable.  Note that the
  11.         return value of this function must be passed to the $regfree()
  12.         function, to return the allocated resources for the compiled pattern.
  13.         The compilation could fail: if you believe the compilation failed, you
  14.         should call $regerror() to fetch the error.
  15.    $regexec() is used to match a previously compiled pattern against a 
  16.         text string.  The function returns 1 if the string is matched by the
  17.         pattern, and 0 if it does not.
  18.    $regerror() is used to fetch the error code for the most recently 
  19.         attempted action on a previously compiled pattern.
  20.    $regfree() is used to return the resources allocated to a compiled
  21.         pattern.  Attempting to use a compiled pattern after it has been 
  22.         passed to regfree is an error and may crash the client.  The
  23.         function returns the FALSE value.
  24.  
  25.    If you neglect to regfree something that was returned by regcomp,
  26.    then that will result in a memory leak.  The client cannot control this,
  27.    and so if you use these functions, it is your duty to keep track of this.
  28.  
  29.    Passing a value to regexec, regerror, or regfree that was not
  30.    previously returned from regcomp is an error and may crash the client.
  31.  
  32. Practical:
  33.    Well, I can not give you any immediately practical uses for these functions.
  34.    They are provided mostly for completeness because they were requested and
  35.    they weren't that difficult to support.
  36.  
  37. Returns:
  38.    $regcomp() returns an opaque r-value suitable for passing to the 
  39.         other three functions.  The return value must be passed later to
  40.         $regfree().
  41.    $regexec() returns 0 or 1 depending on whether the match worked or not
  42.    $regerror() returns the current error condition for a pattern
  43.    $regfree() returns the false value.
  44.  
  45. See Also:
  46.    assign(1); match(6); rmatch(6)
  47.  
  48.